<template>

	<view>
		<bg-video></bg-video>
		<cu-custom bgColor="bg-pink" :isBack="true">
			<block class="text-white" slot="content">评价列表</block>
		</cu-custom>
		<view>
			<view v-for="(pj,index) in ajlpjs" :key="index">
				<view class="shadow bg-white flex justify-start">
					<view class="cu-avatar round xl margin-xs" :style="{backgroundImage: `url(${pj.jcover})`}"></view>
					<view class="flex flex-direction justify-start">
						<view class="padding-xs flex justify-between align-center">
							<text>{{pj.jname}}</text>
							<uni-rate v-model="pj.count"></uni-rate>
						</view>
						<view class="padding-xs">{{pj.content}}</view>
					</view>
				</view>
			</view>
		</view>
		
		<view v-if="ajlpjs.length < pageInfo.total" class="padding flex flex-direction">
			<button @tap="loadMore" class="cu-btn bg-pink lg">显示更多</button>
		</view>
	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				jlid: "",
				jl: this.store.state.jl,
				ajlpjs: [],
				pageInfo: {
					current: 1,
					total: 0,
					size: 12
				}
			};
		},
		onShareAppMessage: function(){
			return {
				title: this.store.state.title,
				path: '/pages/first?id='+this.store.state.client.clientid
			}
		},
		onLoad: function(option){
			this.jlid = option.jlid;
			if (!this.jlid) {
				this.jlid = this.jl.jlid;
			}
			this.LoadPj();
		},
		methods: {
			
			LoadPj: function(){
				this.api("/jl/pj/page").send({
					jlid: this.jlid,
					current:this.pageInfo.current,
					size : this.pageInfo.size
				}).then(data => {
					this.ajlpjs.push(...this.ajlpjs, ...data.ajlpjs.records);
					this.pageInfo.current = data.current;
					this.pageInfo.size = data.size;
					this.pageInfo.total = data.total;
				});
			},
			loadMore: function() {
				this.pageInfo.current++;
				this.LoadPj();
			},
			
		}
	}
</script>

<style>
</style>